//
//  Singleton.m
//  哎游
//
//  Created by 康守帅 on 15-1-8.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "Singleton.h"

Singleton * share = nil;

@implementation Singleton

- (void)dealloc
{
    [super dealloc];
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.musicId = @"-1";
    }
    return self;
}

+ (instancetype)shareInstance
{
    static dispatch_once_t once;
    dispatch_once(&once, ^{
        if (!share) {
            share = [[Singleton alloc] init];
            share.loginState = Tourist;
            share.musicPlayerViewController = [[MusicPlayerViewController alloc] init];
            share.musicPlayState = MusicPlayStateNone;
            share.musicAtIndex = -1;
        }
    });
    [Singleton judgeNetWorkConnect];
    return share;
}

+ (void)judgeNetWorkConnect
{
    if (share.audioPlayer.errorCode != 0) {
        [share.audioPlayer stop];
    }
}


@end
